<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%option explicit%>
<%
Dim RZ_IN
RZ_IN=1
%>
<!--#include file="../conn.inc.asp" -->
<!--#include file="admin_inc/admin.function.asp" -->
<!--#include file="admin_inc/admin.sqlfunction.asp" -->
<%
'作者：山林客（ah_bill）
'博客：http://ruizhinet.blog.163.com
'网站：http://www.ruizhinet.cn
'本信息不会影响您网站的正常访问，请保留
checkadmin(1)
dim id,ad_type,ad_code,ad_imgswf,ad_imgswf_width,ad_imgswf_height,ad_alt,ad_link,ad_author,ad_addtime,ad_begintime,ad_endtime,nowtime, ad_description
ad_type=0
id=GetIntQueryString("id")
ad_addtime=now()
ad_author=session("user_name")
nowtime=Now()
ad_begintime=Year(nowtime)&"-"&Month(nowtime)&"-"&Day(nowtime)
if id>0 then
	dim rsa,sqla
	set rsa = server.createobject("adodb.recordset")
	sqla = "select * from [c_advertise] where id="&id
	rsa.open sqla,conn,1,1
	if rsa.eof or rsa.bof then 
	response.redirect("showmsg.asp?from=advertise_list.asp&msg=norecord")
	else
	ad_type=rsa("ad_type")
	ad_alt=rsa("ad_alt")
	ad_link=rsa("ad_link")
	ad_imgswf=rsa("ad_imgswf")
	ad_imgswf_width=rsa("ad_imgswf_width")
	ad_imgswf_height=rsa("ad_imgswf_height")
	ad_code=rsa("ad_code")
	ad_author=rsa("ad_author")
	ad_addtime=rsa("ad_addtime")
	ad_begintime=rsa("ad_begintime")
	ad_endtime=rsa("ad_endtime")
	ad_description=rsa("ad_description")
	end if 
	rsa.close
	set rsa=nothing 
end if
%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加/修改广告</title>
<script type="text/javascript" src="admin_js/common.js"></script>
<script type="text/javascript" src="admin_js/dateselect.js"></script>
<link type="text/css" href="style/style.css" rel="stylesheet" rev="stylesheet"/>
</head>
<body>
<form method="post" name="rzform" action="advertise_save.asp">
<table class="table_800" cellspacing="0" cellpadding="0">
<%if id>0 then%>
<input type="hidden" name="act" value="modifysave"/>	
<input type="hidden" name="id" value="<%=id%>"/>	
<%else%>
<input type="hidden" name="act" value="addsave"/>	
<%end if%>
<input type="hidden" name="ad_addtime"  value="<%=ad_addtime%>"/>
<input type="hidden" name="ad_author" value="<%=ad_author%>"/>
<tr>
	<th colspan="2"><%if id>0 then%>修改<%else%>添加<%end if%>广告</th>
</tr>
<tr class="row">
	<td>广告类型</td>
	<td>
<select id="ad_type" name="ad_type" onchange="setAdType(this);">	
	<option value="1" <%if ad_type=1 then response.Write("selected='selected'") end if%>>文本</option>
	<option value="2" <%if ad_type=2 then response.Write("selected='selected'") end if%>>图片</option>
	<option value="3" <%if ad_type=3 then response.Write("selected='selected'") end if%>>Flash</option>
	<option value="4" <%if ad_type=4 then response.Write("selected='selected'") end if%>>代码</option>
</select><span class="redstar">*</span>
	</td>
</tr>
<tr class="row" id="tr_ad_begintime">
	<td>有效时间起</td>
	<td><input type="text" id="ad_begintime" name="ad_begintime" readonly="readonly" value="<%=ad_begintime%>" onfocus="calendar(event)"/> <span class="redstar">*</span> </td>
</tr>
<tr class="row" id="tr_ad_endtime">
	<td>有效时间止</td>
	<td><input type="text" id="ad_endtime" name="ad_endtime" readonly="readonly" value="<%=ad_endtime%>" onfocus="calendar(event)"/> <span class="redstar">*</span>格式：2009-01-01</td>
</tr>
<tr class="row" id="tr_ad_alt">
	<td>提示文本</td>
	<td><input type="text" id="ad_alt" name="ad_alt" value="<%=ad_alt%>"/> <span class="redstar">*</span></td>
</tr>
<tr class="row"  id="tr_ad_description">
	<td>广告描述</td>
	<td><textarea id="ad_description" name="ad_description" cols="30" rows="5"><%=ad_description%></textarea><br/></td>
</tr>
<tr  class="row" id="tr_ad_link" <%If ad_type=1 Or ad_type=2 Or ad_type=0 Then %> style="display:'';" <%else%> style="display:none;"<%End If %>>
	<td>广告链接</td>
	<td><input type="text" id="ad_link"  name="ad_link" value="<%=ad_link%>"/> <span class="redstar">*</span> 说明：须使用以http://开头的地址或“/”开头的地址</td>
</tr>
<tr  class="row" id="tr_ad_imgswf" <%If ad_type=2 Or ad_type=3 Then %> style="display:'';" <%else%> style="display:none;"<%End If %>>
	<td>广告图片/Flash</td>
	<td>
	<input type="text" name="ad_imgswf"  style="background-color:#cccccc;" id="ad_imgswf" size="30"  value="<%=ad_imgswf%>"/> <%if ad_imgswf<>"" then%><a href="<%=ad_imgswf%>" target="_blank">[查看]</a><%end if%><input type="button" id="copyimg" name="copyimg" value="从已上传图片中选取" onclick="openWin('selectphoto.asp?photobox=ad_imgswf',840,500);" style="display:none;"/><br/>
<iframe id="uploadframe" marginwidth="0" marginheight="0" frameborder="0" style="width:400px;height:30px" src="rzupload.asp?parentform=rzform&inputname=ad_imgswf" scrolling="no"></iframe><span class="redstar">*</span>
	</td>
</tr>
<tr class="row" id="tr_ad_imgswf_width"  <%If ad_type=2 Or ad_type=3 Then %> style="display:'';" <%else%> style="display:none;"<%End If %>>
	<td>图片/Flash宽度</td>
	<td><input id="ad_imgswf_width" type="text" name="ad_imgswf_width" value="<%if ad_imgswf_width>0 then response.Write(ad_imgswf_width) else response.Write("480") end if%>"/>像素 <span class="redstar">*</span></td>
</tr>
<tr class="row"  id="tr_ad_imgswf_height"  <%If ad_type=2 Or ad_type=3 Then %> style="display:'';" <%else%> style="display:none;"<%End If %>>
	<td>图片/Flash高度</td>
	<td><input id="ad_imgswf_height" type="text" name="ad_imgswf_height" value="<%if ad_imgswf_height>0 then response.Write(ad_imgswf_height) else response.Write("60") end if%>"/>像素 <span class="redstar">*</span></td>
</tr>
<tr class="row"  id="tr_ad_code"  <%If ad_type=4 Then %> style="display:'';" <%else%> style="display:none;"<%End If %>>
	<td>广告代码</td>
	<td><textarea id="ad_codes" name="ad_codes" cols="30" rows="5"><%=ad_code%></textarea><span class="redstar">*</span> <br/></td>
</tr>
<tr>
	<td colspan="2" class="tdcenter">
	<input type="hidden" name="ad_code" id="ad_code"/>
	<input type="button" class="btn" onclick="checkForm('addad');" value="保存"/>&nbsp;&nbsp;&nbsp;<input class="btn" type="reset" value="重置"/></td>
</tr>
</table>
</form>
</body>
</html>
